// 以管道方式操作文件

const fs = require('fs');

const readStream = fs.createReadStream('./writeStream.txt', 'utf8');

const writeStream = fs.createWriteStream('./pipe.txt', 'utf8');

// 用读的流（readStream）的pipe（管道）方式写文件，很简便
readStream.pipe(writeStream);